{include file="public/layout" /}

<!--内容管理后台页面-->

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;min-width:auto;">

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page" style="min-width:auto;box-shadow:none;">

    <div class="flexigrid" style="margin-top: 0px;">

        <div class="mDiv" style="padding: 5px 0px;">

            <div class="ftitle">

                <h3>{$arctype_info.typename|default='全部文档'}</h3>

                <h5>(共{$pager->totalRows}条数据)</h5>

            </div>

            <!--<div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>-->

            <form id="searchForm" class="navbar-form form-inline" action="{:url('Archives/index_archives')}" method="get" onsubmit="layer_loading('正在处理');">

                {$searchform.hidden|default=''}

                <div class="sDiv">

                    {include file="archives/tags_btn" /}


                </div>
            </form>




            <!-- <div class="col-md-3" style="padding:2em 0;">
            <button type="button" class="btn btn-success btn-block" id="generate-excel">
                <i class="fa fa-file-excel-o" aria-hidden="true"></i>导出数据
            </button>
                </div> -->


            <!-- <div class="fbutton" style="float: none;">
                <a href="javascript:;" onclick="method5('tableExcel')" >
                    <div class="add">
                        <span><i class="fa fa-plus" ></i>导出数据</span>
                    </div>
                </a>
            </div> -->
            <!--
                <button type="button" onclick="method4('tableExcel')">导出Excel方法一</button>
                <button type="button" onclick="method2('tableExcel')">导出Excel方法二</button>
                <button type="button" onclick="getXlsFromTbl('tableExcel','myDiv')">导出Excel方法三</button>
                <button type="button" onclick="method4('tableExcel')">导出Excel方法四</button>
                <button type="button" onclick="method5('tableExcel')">导出Excel方法五</button>
            -->

        </div>

        <div class="hDiv">

            <div class="hDivBox">

                <table   cellspacing="0" cellpadding="0" style="width: 100%">

                    <thead>

                    <tr>
                        <th class="sign w40" axis="col0">
                            <div class="tc">选择</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="w40">
                            <div class="tc">ID</div>
                        </th>
                        <th abbr="article_title" axis="col3" class="">
                            <div style="text-align: left; padding-left: 50px;" class="">型号</div>
                        </th>
                         <th abbr="article_time" axis="col6" class="w100">
                            <div class="tc">视频</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="w100">
                            <div class="tc">所属栏目</div>
                        </th>

                        <!--<th abbr="article_time" axis="col6" class="w50">-->

                        <!--    <div class="tc"><a href="{:getArchivesSortUrl('arcrank')}">审核&nbsp;<i {eq name='$Request.param.orderway' value='asc'}class="fa fa-sort"{else /}class="fa fa-sort"{/eq}></i></a></div>-->

                        <!--</th>-->

                        <th abbr="article_time" axis="col6" class="w60">

                            <div class="tc">浏览量</div>

                        </th>

                        {eq name="$arctype_info['current_channel']" value="4"}

                        <th abbr="download_time" axis="col6" class="w60">

                            <div class="tc">下载量</div>

                        </th>

                        {/eq}

                        <th abbr="article_time" axis="col6" class="w100">

                            <div class="tc">发布时间</div>

                        </th>



                        <th abbr="article_time" axis="col6" class="w60">

                            <div class="tc">二维码</div>

                        </th>
                        
                        <th axis="col1" class="w180">

                            <div class="tc">操作</div>

                        </th>

                       

                    </tr>

                    </thead>

                </table>

            </div>

        </div>

        <div class="bDiv" style="height: auto;">

            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">

                <table style="width: 100%;" >

                    <tbody>

                    {empty name="list"}

                        <tr>

                            <td class="no-data" align="center" axis="col0" colspan="50">

                                <i class="fa fa-exclamation-circle"></i>没有符合条件的记录

                            </td>

                        </tr>

                    {else/}

                        {foreach name="list" item="vo" key="k" }

                        <tr>

                            <td class="sign">
                                <div class="tc w40"><input type="checkbox" name="ids[]" value="{$vo.aid}"></div>
                            </td>

                            <td class="sort">
                                <div class="tc w40">{$vo.aid}</div>
                            </td>
                             <td class="sort">
                                <div class="tc w40">

                                     {if condition="$vo.aid ==6000"}
                                        {:dump($vo);exit;}
                                     1
                                     {/if}
                                </div>
                            </td>

                            <td class="" style="width: 100%;">

                                <div class="tl" style="padding-left: 10px;">

                                    {eq name="'Archives@edit'|is_check_access" value="1"}

                                        {if condition="empty($channelRow[$vo['channel']]['ifsystem'])"}

                                            <a href="{:url('Custom/edit',array('id'=>$vo['aid'],'typeid'=>$Request.param.typeid, 'channel'=>$vo.channel))}" style="{eq name="vo.is_b" value="1"} font-weight: bold;{/eq}">{$vo.title}</a>

                                        {else /}

                                            <a href="{:url($channelRow[$vo['channel']]['ctl_name'].'/edit',array('id'=>$vo['aid'],'typeid'=>$Request.param.typeid))}" style="{eq name="vo.is_b" value="1"} font-weight: bold;{/eq}">{$vo.title}</a>

                                        {/if}

                                    {else /}

                                    {$vo.title}

                                    {/eq}

                                    {assign name='showArcFlagData' value='$vo|showArchivesFlagStr'}

                                    {volist name='$showArcFlagData' id="vo1"}

                                        {eq name='$i' value='1'}<span style="color: red;">[{/eq}

                                        <i style="font-size: 12px;">{$vo1['small_name']}</i>

                                        {eq name='$i' value='$showArcFlagData|count'}]</span>{/eq}
                                    {/volist}
                                </div>
                            </td>


                            <td>
                                <?php
                                    $count = M('archives_message')->where('aid',$vo['aid'])->where('status', 2)->count();
                                    if($count){
                                        echo "<h2 class='red' style='font-size: 20px;margin-top: 10px;margin-right: 220px;'>有消息待处理</h2>";
                                    }
                                ?>
                            </td>

                            <td class="">

                                <div class="w100 tc"><p href="">{$vo.is_video?有:无} </p></div>

                            </td>
                            <td class="">

                                <div class="w100 tc"><a href="{:url('Archives/index_archives', array('typeid'=>$vo['typeid']))}">{$vo.typename|default='<i class="red">数据出错！</i>'}</a></div>

                            </td>

                            <!--<td>-->

                                <!--<div class="tc w50">-->

                                <!--    {if condition="$vo['arcrank'] eq -1"}-->

                                <!--        <span class="no" {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"} data-typeid="{$vo.typeid}" data-seo_pseudo="{$seo_pseudo}" onclick="changeTableVal('archives','aid','{$vo.aid}','arcrank',this);" {/eq} ><i class="fa fa-ban"></i>否</span>-->

                                <!--    {else /}-->

                                <!--        <span class="yes" {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"} data-typeid="{$vo.typeid}" data-seo_pseudo="{$seo_pseudo}" onclick="changeTableVal('archives','aid','{$vo.aid}','arcrank',this);" {/eq} ><i class="fa fa-check-circle"></i>是</span>-->

                                <!--    {/if}-->

                                <!--</div>-->

                            <!--</td>-->

                            <td>
                                <div class="tc w60">{$vo.click}</div>
                            </td>

                            {eq name="$arctype_info['current_channel']" value="4"}
                            <td>
                                <div class="tc w60">{$vo.downcount}</div>
                            </td>
                            {/eq}

                            <td>
                                <div class="w100 tc">{$vo.add_time|date='Y-m-d',###}</div>
                            </td>


                            <td class="sort">
                                <div class="w60 tc">
                                    {eq name="'Archives@edit'|is_check_access" value="1"}
                                    <!--<input type="text" onchange="changeTableVal('archives','aid','{$vo.aid}','sort_order',this);"  size="4"  value="{$vo.sort_order}" />-->
                                      
                                    <a href="javascript:void(0);" class="btn blue" onclick="showImg(this);" data-id="{$vo.aid}" data-url="{:url('Archives/qrcode')}" data-tag="{$vo.arcurl}" data-title="{$vo.title}"><i class="fa fa-pencil-square-o"></i>查看</a>

                                    {else /}
                                    {$vo.sort_order}
                                    {/eq}
                                </div>
                            </td>




                            <td class="">

                                <div class="w180 tc">

                                    {eq name="'Archives@edit'|is_check_access" value="1"}
                                        {if condition="empty($channelRow[$vo['channel']]['ifsystem'])"}
                                            <a href="{:url('Custom/edit',array('id'=>$vo['aid'],'typeid'=>$Request.param.typeid, 'channel'=>$vo.channel))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                        {else /}
                                            <a href="{:url($channelRow[$vo['channel']]['ctl_name'].'/edit',array('id'=>$vo['aid'],'typeid'=>$Request.param.typeid))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                        {/if}
                                    {/eq}

                                    {eq name="'Archives@del'|is_check_access" value="1"}
                                    <a class="btn red"  href="javascript:void(0);" data-url="{:url('Archives/del')}" data-id="{$vo.aid}" data-deltype="pseudo" onClick="delfun(this);"><i class="fa fa-trash-o"></i>删除</a>
                                    <a href="{$vo.arcurl}" target="_blank" class="btn blue"><i class="fa fa-pencil-square-o"></i>浏览</a>
                                    {/eq}
                                    
                                    <!--<a href="javascript:void(0);" class="btn blue" onclick="showImg(this);" data-id="{$vo.aid}" data-url="{:url('Archives/qrcode')}" data-tag="{$vo.arcurl}" data-title="{$vo.title}"><i class="fa fa-pencil-square-o"></i>二维码</a>-->

                                </div>

                            </td>

                             

                        </tr>

                        {/foreach}

                    {/empty}

                    </tbody>

                </table>

            </div>

            <div class="iDiv" style="display: none;"></div>

        </div>

        <!--<div class="footer-oper">-->

        <!--    <span class="ml15">-->

        <!--        <input type="checkbox" onclick="javascript:$('input[name*=ids]').prop('checked',this.checked);">-->

        <!--    </span>-->

        <!--    <div class="nav-dropup">-->

        <!--        <button class="layui-btn layui-btn-primary dropdown-bt">批量操作<i class="layui-icon layui-icon-up"></i></button>-->

        <!--        <div class="dropdown-menus" style="display:none;">-->
        <!--            {eq name="'Archives@batch_attr'|is_check_access" value="1"}-->
        <!--            <a href="javascript:void(0);" onclick="batch_attr(this, 'ids', '批量新增属性');" data-url="{:url('Archives/batch_attr', ['opt'=>'add'])}"><i class="fa fa-plus"></i>新增属性</a>-->
        <!--            <a href="javascript:void(0);" onclick="batch_attr(this, 'ids', '批量删除属性');" data-url="{:url('Archives/batch_attr', ['opt'=>'del'])}"><i class="fa fa-close"></i>删除属性</a>-->
        <!--            <hr class="layui-bg-gray">-->
        <!--            {/eq}-->

        <!--            {eq name="'Archives@batch_copy'|is_check_access" value="1"}-->
        <!--            <a href="javascript:void(0);" onclick="func_batch_copy(this, 'ids');" data-url="{:url('Archives/batch_copy', array('typeid'=>$Request.param.typeid))}"><i class="fa fa-copy"></i>复制文档</a>-->
        <!--            {/eq}-->

        <!--            {eq name="'Archives@move'|is_check_access" value="1"}-->
        <!--            <a href="javascript:void(0);" onclick="func_move(this, 'ids');" data-url="{:url('Archives/move', array('typeid'=>$Request.param.typeid))}"><i class="fa fa-hdd-o"></i>移动文档</a>-->
        <!--            {/eq}-->

        <!--            {eq name="'Archives@del'|is_check_access" value="1"}-->
        <!--            <a href="javascript:void(0);" onclick="batch_del(this, 'ids');" data-url="{:url('Archives/del')}" data-deltype="pseudo"><i class="fa fa-close"></i>删除文档</a>-->
        <!--            {/eq}-->

        <!--            {eq name="'Archives@check'|is_check_access" value="1"}-->
        <!--            <a href="javascript:void(0);" onclick="batch_check(this, 'ids');" data-url="{:url('Archives/check')}"><i class="fa fa-check-square-o"></i>审核文档</a>-->
        <!--            {/eq}-->

        <!--        </div>-->

        <!--    </div>-->

        <!--    {eq name="'RecycleBin@archives_index'|is_check_access" value="1"}-->
        <!--    <a href="{:url('RecycleBin/archives_index')}" class="layui-btn layui-btn-primary" title="回收站">-->
        <!--    	<i class="layui-icon layui-icon-delete"></i>回收站</a>-->
        <!--    {/eq}-->

        <!--</div>-->

        <!--分页位置-->

        {$page}



    </div>

</div>


<!-- 导出隐藏 -->
<!-- <div style="display:none">
<table id="tableExcel" width="100%" border="1" cellspacing="0" cellpadding="0">
{empty name="list"}
<tr>
    <td class="no-data" align="center" axis="col0" colspan="50">
        <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
    </td>
</tr>
{else/}
<tr>
    <td colspan="5" align="center">图纸组装步骤</td>
</tr>
{foreach name="list" item="vo" key="k" }
    <tr>
        <td>序号</td>
        <td>连接</td>
    </tr>
    <tr>
        <td>{$vo.aid}</td>
        <td>{$vo.arcurl}</td>
    </tr>
{/foreach}
{/empty}
</table>
</div>
 -->


<link rel="stylesheet" type="text/css" href="__PUBLIC__/export/css/demo.css">

<script src="__PUBLIC__/export/demos/googlegg.js"></script>
<!-- <link href="__PUBLIC__/export/css/bootstrap.min.css" rel="stylesheet"> -->
<!-- <link href="__PUBLIC__/export/css/font-awesome.min.css" rel="stylesheet"> -->
<div class="container" style="display:none">
    <div class="row">
        <!-- <div class="col-md-3" style="padding:2em 0;">
            <button type="button" class="btn btn-success btn-block" id="generate-excel">
                <i class="fa fa-file-excel-o" aria-hidden="true"></i>导出数据
            </button>
        </div> -->
        <div class="col-md-12" style="padding:2em 0;" >
            <div class="table-responsive">
            <table class="table table-bordered table-striped" id="test_table">
            {empty name="list"}
                <tr>
                    <td class="no-data" align="center" axis="col0" colspan="50">
                        <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                    </td>
                </tr>
                {else/}
                <thead>
                  <tr>
                    <td>序号</td>
                    <td>型号</td>
                    <td>视频</td>
                    <td>连接</td>
                  </tr>
                </thead>
                {foreach name="list" item="vo" key="k" }

                <tbody>
                    <tr>
                        <td>
                            <span>{$vo.aid}</span>
                        </td>
                        <td>
                            <span>{$vo.title}</span>
                        </td>
                         <td>
                            <span>{$vo.is_video?有:无} </span>
                        </td>
                        <td>
                            <span>{$vo.arcurl}</span>
                        </td>
                    </tr>
                </tbody>
                {/foreach}
            {/empty}
              </table>
            </div>
        </div>
    </div>
</div>





<script type="text/javascript">

    $(document).ready(function(){



        // 表格行点击选中切换

        $('#flexigrid > table>tbody >tr').click(function(){

            $(this).toggleClass('trSelected');

        });



        // 点击刷新数据

        $('.fa-refresh').click(function(){

            location.href = location.href;

        });



        // 选择栏目检索出相应文档列表

        $('#typeid').change(function(){

          $('#searchForm').submit();

        });



        // 批量操作

        $(".dropdown-bt").click(function(){

            $(".dropdown-menus").slideToggle(200);

            event.stopPropagation();

        })

        $(document).click(function(){

            $(".dropdown-menus").slideUp(200);

            event.stopPropagation();

        })

    });



    var aids = '';

    function func_move(obj, name)

    {

        var a = [];

        var k = 0;

        aids = '';

        $('input[name^='+name+']').each(function(i,o){

            if($(o).is(':checked')){

                a.push($(o).val());

                if (k > 0) {

                    aids += ',';

                }

                aids += $(o).val();

                k++;

            }

        })

        if(a.length == 0){

            layer.alert('请至少选择一项', {icon: 2, title:false});

            return;

        }



        var url = $(obj).attr('data-url');

        //iframe窗

        layer.open({

            type: 2,

            title: '移动文档',

            fixed: true, //不固定

            shadeClose: false,

            shade: 0.3,

            maxmin: false, //开启最大化最小化按钮

            area: ['350px', '260px'],

            content: url

        });

    }

    //显示图片
    function showImg(obj){
        var url = $(obj).data('url');
        var tag = $(obj).data('tag');
        var id = $(obj).data('id');
        var tit = $(obj).data('title');
          console.log(tit);
        $.ajax({

            type: "POST",

            url: url,

            data: {tag:tag,id:id},

            dataType: 'json',

            success: function (data) {
                console.log(data);
                layer.closeAll();

                if(data.code == 1){

                    layer.open({

                        type: 1,

                        title: '二维码',

                        fixed: true, //不固定

                        shadeClose: false,

                        shade: 0.3,

                        maxmin: false, //开启最大化最小化按钮

                        area: ['500px', '520px'],

                        content: "<img src= '"+data.data+"'/><span style='text-align: center;width: 100%;float: left;'>"+tit+"</span> "

                    });

                }else{

                    layer.alert(data.msg, {icon: 2, title:false});

                }

            },

            error:function(){

                layer.closeAll();

                layer.alert(ey_unknown_error, {icon: 2, title:false});

            }

        });
    };

    /**

     * 获取修改之前的内容

     */

    function get_aids()

    {

        return aids;

    }



    /**

     * 批量审核

     */

    function batch_check(obj, name) {



        var url = $(obj).attr('data-url');



        var a = [];

        $('input[name^='+name+']').each(function(i,o){

            if($(o).is(':checked')){

                a.push($(o).val());

            }

        })

        if(a.length == 0){

            layer.alert('请至少选择一项', {icon: 2, title:false});

            return;

        }



        // title = '批量审核';

        // btn = ['确定', '取消']; //按钮

        // // 删除按钮

        // layer.confirm(title, {

        //     title: false,

        //     btn: btn //按钮

        // }, function () {

            layer_loading('正在处理');

            $.ajax({

                type: "POST",

                url: url,

                data: {ids:a, _ajax:1},

                dataType: 'json',

                success: function (data) {

                    layer.closeAll();

                    if(data.code == 1){

                        layer.msg(data.msg, {icon: 1});

                        window.location.reload();

                    }else{

                        layer.alert(data.msg, {icon: 2, title:false});

                    }

                },

                error:function(){

                    layer.closeAll();

                    layer.alert(ey_unknown_error, {icon: 2, title:false});

                }

            });

        // }, function (index) {

        //     layer.closeAll(index);

        // });

    }



     $('#exportData').click(function (){

        var keywords = $('input[name="aid"]').val();

        var url = "{:url('Archives/export')}";

        if (keywords == ''){

            window.open(url);

        }else {

            window.open(url+"&keywords="+keywords);
        }

    });




</script>



<script language="JavaScript" type="text/javascript">
 //第一种方法
        function method1(tableid) {

            var curTbl = document.getElementById(tableid);
            var oXL = new ActiveXObject("Excel.Application");
            var oWB = oXL.Workbooks.Add();
            var oSheet = oWB.ActiveSheet;
            var sel = document.body.createTextRange();
            sel.moveToElementText(curTbl);
            sel.select();
            sel.execCommand("Copy");
            oSheet.Paste();
            oXL.Visible = true;

        }
        //第二种方法
        function method2(tableid)
        {

            var curTbl = document.getElementById(tableid);
            var oXL = new ActiveXObject("Excel.Application");
            var oWB = oXL.Workbooks.Add();
            var oSheet = oWB.ActiveSheet;
            var Lenr = curTbl.rows.length;
            for (i = 0; i < Lenr; i++)
            {        var Lenc = curTbl.rows(i).cells.length;
                for (j = 0; j < Lenc; j++)
                {
                    oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText;

                }

            }
            oXL.Visible = true;
        }
        //第三种方法
        function getXlsFromTbl(inTblId, inWindow){

            try {
                var allStr = "";
                var curStr = "";
                if (inTblId != null && inTblId != "" && inTblId != "null") {

                    curStr = getTblData(inTblId, inWindow);

                }
                if (curStr != null) {
                    allStr += curStr;
                }

                else {

                    alert("你要导出的表不存在");
                    return;
                }
                var fileName = getExcelFileName();
                doFileExport(fileName, allStr);

            }

            catch(e) {

                alert("导出发生异常:" + e.name + "->" + e.description + "!");

            }

        }

        function getTblData(inTbl, inWindow) {

            var rows = 0;
            var tblDocument = document;
            if (!!inWindow && inWindow != "") {

                if (!document.all(inWindow)) {
                    return null;
                }

                else {
                    tblDocument = eval(inWindow).document;
                }

            }

            var curTbl = tblDocument.getElementById(inTbl);
            var outStr = "";
            if (curTbl != null) {
                for (var j = 0; j < curTbl.rows.length; j++) {
                    for (var i = 0; i < curTbl.rows[j].cells.length; i++) {

                        if (i == 0 && rows > 0) {
                            outStr += " t";
                            rows -= 1;
                        }

                        outStr += curTbl.rows[j].cells[i].innerText + "t";
                        if (curTbl.rows[j].cells[i].colSpan > 1) {
                            for (var k = 0; k < curTbl.rows[j].cells[i].colSpan - 1; k++) {
                                outStr += " t";
                            }
                        }
                        if (i == 0) {
                            if (rows == 0 && curTbl.rows[j].cells[i].rowSpan > 1) {
                                rows = curTbl.rows[j].cells[i].rowSpan - 1;
                            }
                        }
                    }
                    outStr += "rn";
                }
            }

            else {
                outStr = null;
                alert(inTbl + "不存在 !");
            }
            return outStr;
        }

        function getExcelFileName() {
            var d = new Date();
            var curYear = d.getYear();
            var curMonth = "" + (d.getMonth() + 1);
            var curDate = "" + d.getDate();
            var curHour = "" + d.getHours();
            var curMinute = "" + d.getMinutes();
            var curSecond = "" + d.getSeconds();
            if (curMonth.length == 1) {
                curMonth = "0" + curMonth;
            }

            if (curDate.length == 1) {
                curDate = "0" + curDate;
            }

            if (curHour.length == 1) {
                curHour = "0" + curHour;
            }

            if (curMinute.length == 1) {
                curMinute = "0" + curMinute;
            }

            if (curSecond.length == 1) {
                curSecond = "0" + curSecond;
            }
            var fileName = "table" + "_" + curYear + curMonth + curDate + "_"
                    + curHour + curMinute + curSecond + ".csv";
            return fileName;

        }

        function doFileExport(inName, inStr) {
            var xlsWin = null;
            if (!!document.all("glbHideFrm")) {
                xlsWin = glbHideFrm;
            }
            else {
                var width = 6;
                var height = 4;
                var openPara = "left=" + (window.screen.width / 2 - width / 2)
                        + ",top=" + (window.screen.height / 2 - height / 2)
                        + ",scrollbars=no,width=" + width + ",height=" + height;
                xlsWin = window.open("", "_blank", openPara);
            }
            xlsWin.document.write(inStr);
            xlsWin.document.close();
            xlsWin.document.execCommand('Saveas', true, inName);
            xlsWin.close();

        }

        //第四种
        function method4(tableid){

            var curTbl = document.getElementById(tableid);
            var oXL;
            try{
                oXL = new ActiveXObject("Excel.Application"); //创建AX对象excel
            }catch(e){
                alert("无法启动Excel!\n\n如果您确信您的电脑中已经安装了Excel，"+"那么请调整IE的安全级别。\n\n具体操作：\n\n"+"工具 → Internet选项 → 安全 → 自定义级别 → 对没有标记为安全的ActiveX进行初始化和脚本运行 → 启用");
                return false;
            }
            var oWB = oXL.Workbooks.Add(); //获取workbook对象
            var oSheet = oWB.ActiveSheet;//激活当前sheet
            var sel = document.body.createTextRange();
            sel.moveToElementText(curTbl); //把表格中的内容移到TextRange中
            sel.select(); //全选TextRange中内容
            sel.execCommand("Copy");//复制TextRange中内容
            oSheet.Paste();//粘贴到活动的EXCEL中
            oXL.Visible = true; //设置excel可见属性
            var fname = oXL.Application.GetSaveAsFilename("将table导出到excel.xls", "Excel Spreadsheets (*.xls), *.xls");
            oWB.SaveAs(fname);
            oWB.Close();
            oXL.Quit();
        }
        //第五种方法
        var idTmr;
        function  getExplorer() {
            var explorer = window.navigator.userAgent ;
            //ie
            if (explorer.indexOf("MSIE") >= 0) {
                return 'ie';
            }
            //firefox
            else if (explorer.indexOf("Firefox") >= 0) {
                return 'Firefox';
            }
            //Chrome
            else if(explorer.indexOf("Chrome") >= 0){
                return 'Chrome';
            }
            //Opera
            else if(explorer.indexOf("Opera") >= 0){
                return 'Opera';
            }
            //Safari
            else if(explorer.indexOf("Safari") >= 0){
                return 'Safari';
            }
        }
        function method5(tableid) {
            if(getExplorer()=='ie')
            {
                var curTbl = document.getElementById(tableid);
                var oXL = new ActiveXObject("Excel.Application");
                var oWB = oXL.Workbooks.Add();
                var xlsheet = oWB.Worksheets(1);
                var sel = document.body.createTextRange();
                sel.moveToElementText(curTbl);
                sel.select();
                sel.execCommand("Copy");
                xlsheet.Paste();
                oXL.Visible = true;

                try {
                    var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
                } catch (e) {
                    print("Nested catch caught " + e);
                } finally {
                    oWB.SaveAs(fname);
                    oWB.Close(savechanges = false);
                    oXL.Quit();
                    oXL = null;
                    idTmr = window.setInterval("Cleanup();", 1);
                }

            }
            else
            {
                tableToExcel(tableid)
            }
        }
        function Cleanup() {
            window.clearInterval(idTmr);
            CollectGarbage();
        }
        var tableToExcel = (function() {
            var uri = 'data:application/vnd.ms-excel;base64,',
                    template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',
                    base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },
                    format = function(s, c) {
                        return s.replace(/{(\w+)}/g,
                                function(m, p) { return c[p]; }) }
            return function(table, name) {
                if (!table.nodeType) table = document.getElementById(table)
                var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
                window.location.href = uri + base64(format(template, ctx))
            }
        })()

    </script>




<script type="text/javascript" src="__PUBLIC__/export/external/jquery-1.8.2.js"></script>
<script type="text/javascript" src="__PUBLIC__/export/external/jszip.js"></script>
<script type="text/javascript" src="__PUBLIC__/export/external/FileSaver.js"></script>
<script type="text/javascript" src="__PUBLIC__/export/scripts/excel-gen.js"></script>
<script type="text/javascript" src="__PUBLIC__/export/scripts/demo.page.js"></script>



{include file="public/footer" /}